{/* LAYOUT模板 */}
	<layout name="layout"/>
{/* LAYOUT模板 */}

{/* import Js,Css */}
	<js href="__PUBLIC__/Js/admin/listTable.js"/>
	<js href="__PUBLIC__/Js/admin/js.util.js"/>
	<css href="__PUBLIC__/Css/admin/common.css"/>
	<js href="__PUBLIC__/Js/admin/js.selectzone.js"/>
	
	<css href="__PUBLIC__/Css/jquery-ui.css" />
	<js href="__PUBLIC__/Js/core/jquery-ui.1.10.4.js" />
	<js href="__PUBLIC__/Js/core/plugins.js"/>
{/* import Js,Css */}

<!-- [position] -->
	<include file="Template:position"/>
<!-- [position] -->

<div class="main-div">
	<form method="post" action="__URL__/{$action}" name="theForm" onsubmit="return validate()">
		<table width="100%" >
			<tr>
				<td class="label" align="right">会员名称:</td>
				<td>
					<if condition="$form_action eq 'update'">
						{$user.user_name}
						<input type="hidden" name="username" value="{$user.user_name}" />
					<else/>
						<input type="text" name="username" maxlength="60" value="{$user.user_name}" />
						*
					</if>
				</td>
			</tr>
			<if condition="$form_action eq 'update'">
			<tr>
				<td class="label"  align="right">可用资金:</td>
				<td>
					{$user.formated_user_money} 
					<a href="account_log.php?act=list&user_id={$user.user_id}&account_type=user_money">
						[ 查看明细 ]
					</a> 
				</td>
			</tr>
			<tr>
				<td class="label"  align="right">冻结资金:</td>
				<td>
					{$user.formated_frozen_money} 
					<a href="account_log.php?act=list&user_id={$user.user_id}&account_type=frozen_money">
						[ 查看明细 ]
					</a>
				</td>
			</tr>
			<tr>
				<td class="label"  align="right">
					<a href="javascript:showNotice('noticeRankPoints');" title="{$lang.form_notice}">
						<img src="__PUBLIC__/Image/Admin/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}">
					</a> 
					等级积分:
				</td>
				<td>
					{$user.rank_points} 
					<a href="account_log.php?act=list&user_id={$user.user_id}&account_type=rank_points">
						[ 查看明细 ]
					</a>
					<br />
					<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeRankPoints">
						等级积分是一种累计的积分，系统根据该积分来判定用户的会员等级。
					</span>
				</td>
			</tr>
			<tr>
				<td class="label"  align="right">
					<a href="javascript:showNotice('noticePayPoints');" title="{$lang.form_notice}">
						<img src="__PUBLIC__/Image/Admin/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}" />
					</a> 
					消费积分:
				</td>
				<td>
					{$user.pay_points} 
					<a href="account_log.php?act=list&user_id={$user.user_id}&account_type=pay_points">
						[ 查看明细 ]
					</a> 
					<br />
					<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticePayPoints">
						消费积分是一种站内货币，允许用户在购物时支付一定比例的积分。
					</span>
				</td>
			</tr>
			</if>
			<tr>
				<td class="label"  align="right">邮件地址:</td>
				<td>
					<input type="text" name="email" maxlength="60" size="40" value="{$user.email}" />{$lang.require_field}
				</td>
			</tr>
			<if condition="$form_action eq 'insert'">
			<tr>
				<td class="label"  align="right">新密码:</td>
				<td>
					<input type="password" name="password" maxlength="20" size="20" />{$lang.require_field}
				</td>
			</tr>
			<tr>
				<td class="label"  align="right">确认密码:	</td>
				<td>
					<input type="password" name="confirm_password" maxlength="20" size="20" />{$lang.require_field}
				</td>
			</tr>
			<elseif condition="$form_action eq 'update'"/>
			<tr>
				<td class="label"  align="right">新密码：</td>
				<td><input type="password" name="password" maxlength="20" size="20" /></td>
			</tr>
			<tr>
				<td class="label"  align="right">确认密码</td>
				<td><input type="password" name="confirm_password" maxlength="20" size="20" /></td>
			</tr>
			</if>
			<tr>
				<td class="label"  align="right">会员等级:</td>
				<td>
					<select name="user_rank">
						<option value="0">非特殊等级</option>
						<volist name="special_ranks" id="rank" key="key">
						<option value="{$key}">{$rank}</option>
						</volist>
					</select>
				</td>
			</tr>
			<tr>
				<td class="label"  align="right">性别：</td>
				<td>
					<input type="radio" name="sex" value="0" checked="">&nbsp;保密&nbsp;
					<input type="radio" name="sex" value="1">&nbsp;男&nbsp;
					<input type="radio" name="sex" value="2">&nbsp;女&nbsp;
				</td>
			</tr>
			<tr>
				<td class="label"  align="right">出生日期:</td>
				<td>
					<select name="birthdayYear">
						<option value="1954">1954</option>
						<option value="2013">2013</option>
						<option value="2014">2014</option>
						<option value="2015">2015</option></select>&nbsp;
					<select name="birthdayMonth">
						<option value="1">01</option>
						<option value="2">02</option>
						<option value="3">03</option>
						<option value="4">04</option>
						<option value="5">05</option>
						<option value="6">06</option>
						<option value="7">07</option>
						<option value="8">08</option>
						<option value="9">09</option>
						<option value="10">10</option>
						<option value="11">11</option>
						<option value="12">12</option>
						</select>&nbsp;
					<select name="birthdayDay">
						<option value="1">01</option>
						<option value="30">30</option>
						<option value="31">31</option>
					</select>
				</td>
			</tr>
			<tr>
				<td class="label"  align="right">信用额度:</td>
				<td><input name="credit_line" type="text" id="credit_line" value="{$user.credit_line}" size="10" /></td>
			</tr>
			<volist name="extend_info_list" id="field">
			<tr>
				<td class="label" align="right">{$field.reg_field_name}:</td>
				<td>
				<input name="extend_field{$field.id}" type="text" size="40" class="inputBg" value="{$field.content}"/>
				</td>
			</tr>
			</volist>
			<if condition="$user['parent_id']">
			<tr>
				<td class="label">{$lang.parent_user}:</td>
				<td>
					<a href="users.php?act=edit&id={$user.parent_id}">{$user.parent_username}</a>&nbsp;&nbsp;&nbsp;&nbsp;
					<a href="users.php?act=remove_parent&id={$user.user_id}">{$lang.parent_remove}</a>
				</td>
			</tr>
			</if>
			<if condition="$affiliate['on'] eq 1 and $affdb">
			<tr>
				<td class="label">{$lang.affiliate_user}:</td>
				<td>
					[<a href="users.php?act=aff_list&auid={$user.user_id}">{$lang.show_affiliate_users}</a>]
					[<a href="affiliate_ck.php?act=list&auid={$user.user_id}">{$lang.show_affiliate_orders}</a>]
				</td>
			</tr>
			<tr>
				<td></td>
				<td>   
					<table border="0" cellspacing="1" style="background: #dddddd; width:30%;">
						<tr>
							<td bgcolor="#ffffff">{$lang.affiliate_lever}</td>
							<volist name="affdb" id="val0" key="level">
							<td bgcolor="#ffffff">{$level}</td>
							</volist>
						</tr>
						<tr>
							<td bgcolor="#ffffff">{$lang.affiliate_num}</td>
							<volist name="affdb" id="val">
							<td bgcolor="#ffffff">{$val.num}</td>
							</volist>
						</tr>
					</table>
				</td>
			</tr>
			</if>
			<tr>
				<td colspan="2" align="center">
					<input type="submit" value="确定" />
					<input type="reset" value="重置" />
					<input type="hidden" name="act" value="{$form_action}" />
					<input type="hidden" name="id" value="{$user.user_id}" />    
				</td>
			</tr>
		</table>
	</form>
</div>


<script language="JavaScript">
	if (document.forms['theForm'].elements['act'].value == "insert"){
	  document.forms['theForm'].elements['username'].focus();
	}
	else{
	  document.forms['theForm'].elements['email'].focus();
	}
	onload = function(){
		// 开始检查订单
		startCheckOrder();
	}
	/**
	 * 检查表单输入的数据
	 */
	function validate(){
		validator = new Validator("theForm");
		validator.isEmail("email", invalid_email, true);

		if (document.forms['theForm'].elements['act'].value == "insert"){
			validator.required("username",  no_username);
			validator.required("password", no_password);
			validator.required("confirm_password", no_confirm_password);
			validator.eqaul("password", "confirm_password", password_not_same);

			var password_value = document.forms['theForm'].elements['password'].value;
			if (password_value.length < 6){
			  validator.addErrorMsg(less_password);
			}
			if (/ /.test(password_value) == true){
			  validator.addErrorMsg(passwd_balnk);
			}
		}
		else if (document.forms['theForm'].elements['act'].value == "update"){
			var newpass = document.forms['theForm'].elements['password'];
			var confirm_password = document.forms['theForm'].elements['confirm_password'];
			if(newpass.value.length > 0 || confirm_password.value.length){
			  if(newpass.value.length >= 6 || confirm_password.value.length >= 6){
				validator.eqaul("password", "confirm_password", password_not_same);
			  }
			  else{
				validator.addErrorMsg(password_len_err);
			  }
			}
		}
		return validator.passed();
	}


</script>





